#include "get_arg.h"
#include <iostream>
#include <stdlib.h>
#include <sstream>
#include <fstream>
#include <portable_timer.h>
#include <open_stream_name_with_substitutions.h>
#include <print_error.h>


using namespace std;
using namespace bcpp_matrix;
using boost::lexical_cast;
using std::ostringstream;
using std::istringstream;
using std::ofstream;
using std::ifstream;


int main (int argc, char *argv[])
{
	t_program_args args;
	try
	{
		if (!process_command_line_options(argc, argv, args))
			return 1;

		for (unsigned i = 0; i < args.input_files.size(); ++i)
		{
			std::ofstream ostrm;
			std::string new_file_name = get_file_name_substitutions(args.path,
														args.input_files[i], args.custom_flags);
			if (args.is_verbose())
				cout<< "\n"
					   "original file =\t" <<args.input_files[i] << "\n"
					<< "format string =\t" << args.path << "\n"
					<< "new file      =\t";
			cout << new_file_name << std::endl;
		}
	}
	catch(std::exception& e)
	{
		std_print_error(args.CERR(),  e.what());
		return 1;

	}
	return 0;






	cerr << "\n";
	cerr << string(10, '!') << "\nEverything worked!!\n";

	return 0;
}


